package mapPackage;

public class IDTroncon {
	private String ville1;
	private String ville2;
	private String route;
	
	public IDTroncon(String route, String ville1, String ville2) {
		this.route	= route;
		this.ville1	= ville1;
		this.ville2	= ville2;
	}
	
	public String getVille1() {
		return ville1;
	}
	
	public String getVille2() {
		return ville2;
	}
	
	public String getRoute() {
		return route;
	}
	
	public boolean equals(Object o) {
		if ( o instanceof IDTroncon ) {
			IDTroncon id = (IDTroncon)o;
			return (id.route.equals(route) && ((id.ville1.equals(ville1) && id.ville2.equals(ville2)) || (id.ville1.equals(ville2) && id.ville2.equals(ville1) ) ) );
		} else { return false; }
	}
	
	public int hashCode() {
		return route.hashCode()+ ville1.hashCode() + ville2.hashCode();
	}
	
	public String toString() {
		return route+"_"+ville1+"_"+ville2;
	}
}
